<template>
	<view>
		<view class="pay_success">
			<view class="divContent">
				<image src="../../static/images/success.png" />
				<view class="divSuccess">下单成功</view>
				<view class="divDesc"></view>
				<view class="btnView" @click="updateOrder">去支付</view>
				<view class="divDesc1"></view>
				<view class="btnView" @click="toOrderPage">查看订单</view>
				
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getBaseUrl,
		requestUtil,
		getWxLogin,
		getUserProfile
	} from '../../utils/requestUtils';
	import regeneratorRuntime, {
		async
	} from '../../lib/runtime/runtime';
	import {
		orderUpdateApi,
	} from '../../api/orderList.js';
	export default {
		data() {
			return {
				finishTime: ''
			};
		},
		onUnload() {
			uni.switchTab({
				url:'/pages/index/index'
			})
			
		},
		computed: {},
		created() {
			this.getFinishTime()
		},
		mounted() {},
		methods: {			
			toOrderPage(){
				console.log("执行了")
				uni.navigateTo({
					url:'/pages/Order/order'
				})
							
			},
			//获取送达时间
			getFinishTime() {
				let now = new Date()
				let hour = now.getHours() + 1
				let minute = now.getMinutes()
				if (hour.toString().length < 2) {
					hour = '0' + hour
				}
				if (minute.toString().length < 2) {
					minute = '0' + minute
				}
				this.finishTime = hour + ':' + minute
			},
			async updateOrder() {
				let orderNumber = wx.getStorageSync("orderNumber")
				console.log("=================orderNumber"+orderNumber)
				const res = await orderUpdateApi({
					status: 2,
					number: orderNumber
				})
				if (res.code === 0) {
					uni.navigateTo({
						url: '/pages/paySuccess/paySuccess'
					})
				} else {
					return uni.$showMsg(res.msg)
				}
			}

		}
	}
</script>

<style>
@import url(./paySuccess.css);
</style>
